package xiazai;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;

public class Client {
    public static void main(String[] args) throws IOException {
        Socket socket = new Socket("localhost",10001);
        InputStream is = socket.getInputStream();
        OutputStream os = new FileOutputStream("/Users/edy/Desktop/file/"+System.currentTimeMillis()+".txt");
        int len;
        byte[] bytes = new byte[1024];
        while ((len = is.read(bytes)) > 0) {
            os.write(bytes);
        }

    }
}
